<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="108px">
      <el-form-item label="提现发起日期" prop="initiationDate">
        <el-input
          v-model="queryParams.initiationDate"
          placeholder="请输入提现发起日期"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="劵核销时间" prop="verifiTime">
        <el-input
          v-model="queryParams.verifiTime"
          placeholder="请输入劵核销时间"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="券码" prop="couponCode">
        <el-input
          v-model="queryParams.couponCode"
          placeholder="请输入券码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <template v-if="showMoreCondition">
        <el-form-item label="分账单id" prop="billId">
          <el-input
            v-model="queryParams.billId"
            placeholder="请输入分账单id"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家id" prop="merchantId">
          <el-input
            v-model="queryParams.merchantId"
            placeholder="请输入商家id"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商家名称" prop="merchantName">
          <el-input
            v-model="queryParams.merchantName"
            placeholder="请输入商家名称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="团购id" prop="groupId">
          <el-input
            v-model="queryParams.groupId"
            placeholder="请输入团购id"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="团购名称" prop="groupName">
          <el-input
            v-model="queryParams.groupName"
            placeholder="请输入团购名称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="商品价格" prop="proPrice">
          <el-input
            v-model="queryParams.proPrice"
            placeholder="请输入商品价格"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="内容类型" prop="contentType">
          <el-select v-model="queryParams.contentType" placeholder="请选择内容类型" clearable
                     size="small">
            <el-option
              v-for="dict in contentTypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="内容id" prop="contentId">
          <el-input
            v-model="queryParams.contentId"
            placeholder="请输入内容id"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="内容标题" prop="contentTitle">
          <el-input
            v-model="queryParams.contentTitle"
            placeholder="请输入内容标题"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="达人uid" prop="tiktokUid">
          <el-input
            v-model="queryParams.tiktokUid"
            placeholder="请输入达人uid"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="达人抖音号" prop="tiktokNo">
          <el-input
            v-model="queryParams.tiktokNo"
            placeholder="请输入达人抖音号"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="达人昵称" prop="tiktokNick">
          <el-input
            v-model="queryParams.tiktokNick"
            placeholder="请输入达人昵称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="核销GMV(元)" prop="gmvPrice">
          <el-input
            v-model="queryParams.gmvPrice"
            placeholder="请输入核销GMV(元)"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="总收入(元)" prop="totalPrice">
          <el-input
            v-model="queryParams.totalPrice"
            placeholder="请输入总收入(元)"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="达人佣金支出(元)" prop="expendPrice">
          <el-input
            v-model="queryParams.expendPrice"
            placeholder="请输入达人佣金支出(元)"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="机构实收金额(元)" prop="actualPrice">
          <el-input
            v-model="queryParams.actualPrice"
            placeholder="请输入机构实收金额(元)"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="佣金类型" prop="commissionType">

          <el-select v-model="queryParams.commissionType" placeholder="请选择佣金类型" clearable
                     size="small">
            <el-option
              v-for="dict in commissionTypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            />
          </el-select>

        </el-form-item>
        <el-form-item label="订单id" prop="orderId">
          <el-input
            v-model="queryParams.orderId"
            placeholder="请输入订单id"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="订单支付成功时间" prop="orderTime">
          <el-input
            v-model="queryParams.orderTime"
            placeholder="请输入订单支付成功时间"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="跟进人" prop="followPerson">
          <el-input
            v-model="queryParams.followPerson"
            placeholder="请输入跟进人"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否结算过" prop="sfSettlement">
          <el-input
            v-model="queryParams.sfSettlement"
            placeholder="请输入是否结算过"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
      </template>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <el-button
          :icon="showMoreCondition ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
          size="mini"
          @click="showMoreCondition = !showMoreCondition"
        >{{ showMoreCondition ? "收起" : "展开" }}
        </el-button>

      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <!--      <el-col :span="1.5">
              <el-button
                type="primary"
                plain
                icon="el-icon-plus"
                size="mini"
                @click="handleAdd"
                v-hasPermi="['workbench:tiktokOrder:add']"
              >新增
              </el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="success"
                plain
                icon="el-icon-edit"
                size="mini"
                :disabled="single"
                @click="handleUpdate"
                v-hasPermi="['workbench:tiktokOrder:edit']"
              >修改
              </el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                size="mini"
                :disabled="multiple"
                @click="handleDelete"
                v-hasPermi="['workbench:tiktokOrder:remove']"
              >删除
              </el-button>
            </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['workbench:tiktokOrder:export']"
        >导出
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-upload2"
          size="mini"
          @click="handleImport"
          v-hasPermi="['workbench:tiktokOrder:import']"
        >导入
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="tiktokOrderList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="主键id" align="center" prop="id" v-if="false"/>
      <el-table-column label="提现发起日期" align="center" prop="initiationDate"/>
      <el-table-column label="劵核销时间" align="center" prop="verifiTime"/>
      <el-table-column label="券码" align="center" prop="couponCode"/>
      <el-table-column label="分账单id" align="center" prop="billId"/>
      <el-table-column label="商家id" align="center" prop="merchantId"/>
      <el-table-column label="商家名称" align="center" prop="merchantName"/>
      <el-table-column label="团购id" align="center" prop="groupId"/>
      <el-table-column label="团购名称" align="center" prop="groupName" :show-overflow-tooltip="true"/>
      <el-table-column label="商品价格" align="center" prop="proPrice"/>
      <el-table-column label="内容类型" align="center" prop="contentType" :formatter="contentTypeFormat"/>
      <el-table-column label="内容id" align="center" prop="contentId"/>
      <el-table-column label="内容标题" align="center" prop="contentTitle" :show-overflow-tooltip="true"/>
      <el-table-column label="达人uid" align="center" prop="tiktokUid"/>
      <el-table-column label="达人抖音号" align="center" prop="tiktokNo"/>
      <el-table-column label="达人昵称" align="center" prop="tiktokNick"/>
      <el-table-column label="核销GMV(元)" align="center" prop="gmvPrice"/>
      <el-table-column label="总收入(元)" align="center" prop="totalPrice"/>
      <el-table-column label="达人佣金支出(元)" align="center" prop="expendPrice"/>
      <el-table-column label="机构实收金额(元)" align="center" prop="actualPrice"/>
      <el-table-column label="佣金类型" align="center" prop="commissionType" :formatter="commissionTypeFormat"/>
      <el-table-column label="订单id" align="center" prop="orderId"/>
      <el-table-column label="订单支付成功时间" align="center" prop="orderTime"/>
      <el-table-column label="跟进人" align="center" prop="followPerson"/>
      <!--      <el-table-column label="是否结算过  " align="center" prop="sfSettlement" :formatter="sfSettlementFormat"/>-->
      <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['workbench:tiktokOrder:edit']"
          >查看
          </el-button>
          <!--          <el-button-->
          <!--            size="mini"-->
          <!--            type="text"-->
          <!--            icon="el-icon-delete"-->
          <!--            @click="handleDelete(scope.row)"-->
          <!--            v-hasPermi="['workbench:tiktokOrder:remove']"-->
          <!--          >删除-->
          <!--          </el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改抖音订单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="128px">
        <el-form-item label="提现发起日期" prop="initiationDate">
          <el-input v-model="form.initiationDate" placeholder="请输入提现发起日期"/>
        </el-form-item>
        <el-form-item label="劵核销时间" prop="verifiTime">
          <el-input v-model="form.verifiTime" placeholder="请输入劵核销时间"/>
        </el-form-item>
        <el-form-item label="券码" prop="couponCode">
          <el-input v-model="form.couponCode" placeholder="请输入券码"/>
        </el-form-item>
        <el-form-item label="分账单id" prop="billId">
          <el-input v-model="form.billId" placeholder="请输入分账单id"/>
        </el-form-item>
        <el-form-item label="商家id" prop="merchantId">
          <el-input v-model="form.merchantId" placeholder="请输入商家id"/>
        </el-form-item>
        <el-form-item label="商家名称" prop="merchantName">
          <el-input v-model="form.merchantName" placeholder="请输入商家名称"/>
        </el-form-item>
        <el-form-item label="团购id" prop="groupId">
          <el-input v-model="form.groupId" placeholder="请输入团购id"/>
        </el-form-item>
        <el-form-item label="团购名称" prop="groupName">
          <el-input v-model="form.groupName" placeholder="请输入团购名称"/>
        </el-form-item>
        <el-form-item label="商品价格" prop="proPrice">
          <el-input v-model="form.proPrice" placeholder="请输入商品价格"/>
        </el-form-item>
        <el-form-item label="内容类型" prop="contentType">
          <el-select v-model="form.contentType" placeholder="请选择内容类型">
            <el-option
              v-for="dict in contentTypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="内容id" prop="contentId">
          <el-input v-model="form.contentId" placeholder="请输入内容id"/>
        </el-form-item>
        <el-form-item label="内容标题" prop="contentTitle">
          <el-input v-model="form.contentTitle" placeholder="请输入内容标题"/>
        </el-form-item>
        <el-form-item label="达人uid" prop="tiktokUid">
          <el-input v-model="form.tiktokUid" placeholder="请输入达人uid"/>
        </el-form-item>
        <el-form-item label="达人抖音号" prop="tiktokNo">
          <el-input v-model="form.tiktokNo" placeholder="请输入达人抖音号"/>
        </el-form-item>
        <el-form-item label="达人昵称" prop="tiktokNick">
          <el-input v-model="form.tiktokNick" placeholder="请输入达人昵称"/>
        </el-form-item>
        <el-form-item label="核销GMV(元)" prop="gmvPrice">
          <el-input v-model="form.gmvPrice" placeholder="请输入核销GMV(元)"/>
        </el-form-item>
        <el-form-item label="总收入(元)" prop="totalPrice">
          <el-input v-model="form.totalPrice" placeholder="请输入总收入(元)"/>
        </el-form-item>
        <el-form-item label="达人佣金支出(元)" prop="expendPrice">
          <el-input v-model="form.expendPrice" placeholder="请输入达人佣金支出(元)"/>
        </el-form-item>
        <el-form-item label="机构实收金额(元)" prop="actualPrice">
          <el-input v-model="form.actualPrice" placeholder="请输入机构实收金额(元)"/>
        </el-form-item>
        <el-form-item label="佣金类型" prop="commissionType">
          <el-input v-model="form.commissionType" placeholder="佣金类型"/>
        </el-form-item>
        <el-form-item label="订单id" prop="orderId">
          <el-input v-model="form.orderId" placeholder="请输入订单id"/>
        </el-form-item>
        <el-form-item label="订单支付成功时间" prop="orderTime">
          <el-input v-model="form.orderTime" placeholder="请输入订单支付成功时间"/>
        </el-form-item>
        <el-form-item label="跟进人" prop="followPerson">
          <el-input v-model="form.followPerson" placeholder="请输入跟进人"/>
        </el-form-item>
        <el-form-item label="是否结算过" prop="sfSettlement">
          <el-input v-model="form.sfSettlement" placeholder="请输入是否结算过"/>
        </el-form-item>


        <el-form-item label="创建时间" prop="createTime">
          <el-date-picker clearable size="small"
                          v-model="form.createTime"
                          type="datetime"
                          value-format="yyyy-MM-dd HH:mm:ss"
                          placeholder="选择创建时间">
          </el-date-picker>
        </el-form-item>


      </el-form>
      <!--      <div slot="footer" class="dialog-footer">-->
      <!--        <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>-->
      <!--        <el-button @click="cancel">取 消</el-button>-->
      <!--      </div>-->
    </el-dialog>
    <!-- 导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div slot="tip" class="el-upload__tip">
          <el-link type="info" style="font-size:14px;color:green" @click="importTemplate">点击下载模板</el-link>
        </div>
        <div slot="tip" class="el-upload__tip" style="color:red">提示：仅允许导入“xls”或“xlsx”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  addTiktokOrder,
  delTiktokOrder,
  exportTiktokOrder,
  getTiktokOrder,
  listTiktokOrder,
  updateTiktokOrder,
  importTemplate
} from "@/api/workbench/tiktokOrder";
import {getToken} from '@/utils/auth'

export default {
  name: "TiktokOrder",
  data() {
    return {
      timerId: null,
      contentTypeOptions: undefined,
      commissionTypeOptions:undefined,
      showMoreCondition: false, // 是否展开搜索条件
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 抖音订单表格数据
      tiktokOrderList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 导入参数
      upload: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: '',
        // 是否禁用上传
        isUploading: false,
        // 设置上传的请求头部
        headers: {Authorization: 'Bearer ' + getToken()},
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + '/workbench/tiktokOrder/import'
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        initiationDate: undefined,
        verifiTime: undefined,
        couponCode: undefined,
        billId: undefined,
        merchantId: undefined,
        merchantName: undefined,
        groupId: undefined,
        groupName: undefined,
        proPrice: undefined,
        contentType: undefined,
        contentId: undefined,
        contentTitle: undefined,
        tiktokUid: undefined,
        tiktokNo: undefined,
        tiktokNick: undefined,
        gmvPrice: undefined,
        totalPrice: undefined,
        expendPrice: undefined,
        actualPrice: undefined,
        commissionType: undefined,
        orderId: undefined,
        orderTime: undefined,
        followPerson: undefined,
        sfSettlement: undefined,
        delFlag: undefined,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {}
    };
  },
  created() {
    this.getList();
    this.getDicts('content_type').then(response => {
      this.contentTypeOptions = response.data;
    });
    this.getDicts('commission_type').then(response => {
      this.commissionTypeOptions = response.data;
    });
  },
  methods: {
    /** 查询抖音订单列表 */
    getList() {
      this.loading = true;
      listTiktokOrder(this.queryParams).then(response => {
        this.tiktokOrderList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        initiationDate: undefined,
        verifiTime: undefined,
        couponCode: undefined,
        billId: undefined,
        merchantId: undefined,
        merchantName: undefined,
        groupId: undefined,
        groupName: undefined,
        proPrice: undefined,
        contentType: undefined,
        contentId: undefined,
        contentTitle: undefined,
        tiktokUid: undefined,
        tiktokNo: undefined,
        tiktokNick: undefined,
        gmvPrice: undefined,
        totalPrice: undefined,
        expendPrice: undefined,
        actualPrice: undefined,
        commissionType: undefined,
        orderId: undefined,
        orderTime: undefined,
        followPerson: undefined,
        sfSettlement: undefined,
        delFlag: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined,
        remark: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加抖音订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getTiktokOrder(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = "查看抖音订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateTiktokOrder(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addTiktokOrder(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除抖音订单编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.loading = true;
        return delTiktokOrder(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有抖音订单数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.exportLoading = true;
        return exportTiktokOrder(queryParams);
      }).then(response => {
        this.download(response.msg);
        this.exportLoading = false;
      }).catch(() => {
      });
    },
    /** 导入按钮操作 */
    handleImport() {
      this.upload.title = '抖音订单导入';
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      importTemplate().then(response => {
        this.download(response.msg);
      });
    },
    /** 文件上传中处理*/
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    /** 文件上传成功处理*/
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(response.msg, '导入结果', {dangerouslyUseHTMLString: true});
      this.getList();
      // 创建定时器
      this.createTimer();
    },
    /** 提交上传文件*/
    submitFileForm() {
      this.$refs.upload.submit();
    },
    contentTypeFormat(row, column) {
      return this.selectDictLabel(this.contentTypeOptions, row.contentType);
    },
    commissionTypeFormat(row, column) {
      return this.selectDictLabel(this.commissionTypeOptions, row.commissionType);
    },
    createTimer() {
      // 创建定时器，并将定时器ID存储在this.timerId
      this.timerId = setInterval(() => {

        // 如果读取到数据了 则取消定时器
        if (this.tiktokOrderList.length != 0) {
          this.destroyTimer();
        } else {
          this.getList();
        }

      }, 1000);
    },
    destroyTimer() {
      // 如果定时器存在，则清除定时器
      if (this.timerId) {
        clearInterval(this.timerId);
        this.timerId = null;
      }
    }
  }
};
</script>
